package com.ld.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ld.annotation.RedisCache;
import com.ld.entity.User;
import com.ld.mapper.UserMapper;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author LiDong
 * @since 2018-12-05
 */

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Override
    public List<User> selectCustomUsers() {
        return baseMapper.selectUsers();
    }

    @Override
//    @RedisCache
    public User selectUserByUserName(String userName) {
        if(StringUtils.isNotBlank(userName)){
//           User user = baseMapper.selectOne(new QueryWrapper<User>().lambda().eq(User::getUserName,userName));
//           if(ObjectUtils.allNotNull(user)){
//               return user;
//           }
        }
        return new User();
    }
}
